<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>HTML表格及表单的使用 | 乐枫的草稿箱</title><meta name="author" content="乐枫"><meta name="copyright" content="乐枫"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="1.表格标签1.表格的作用用于显示和展示数据，特点：清爽   1.2.表格的基本语法12345678910111213&lt;table&gt;    &lt;tr&gt;        &lt;td&gt;单元格内的文字&lt;&#x2F;td&gt;    &lt;&#x2F;tr&gt;&lt;&#x2F;table&gt;&#96;&#96;&#96;  1. &#96;&#96;&#96;&lt;table&gt;&lt;&#x2F;table&gt;&#96;&#96;&#96; 定义表格2.">
<meta property="og:type" content="article">
<meta property="og:title" content="HTML表格及表单的使用">
<meta property="og:url" content="https://lefengpiaoling.github.io/archives/c95afcba.html">
<meta property="og:site_name" content="乐枫的草稿箱">
<meta property="og:description" content="1.表格标签1.表格的作用用于显示和展示数据，特点：清爽   1.2.表格的基本语法12345678910111213&lt;table&gt;    &lt;tr&gt;        &lt;td&gt;单元格内的文字&lt;&#x2F;td&gt;    &lt;&#x2F;tr&gt;&lt;&#x2F;table&gt;&#96;&#96;&#96;  1. &#96;&#96;&#96;&lt;table&gt;&lt;&#x2F;table&gt;&#96;&#96;&#96; 定义表格2.">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://lefengpiaoling.github.io/img/top.webp">
<meta property="article:published_time" content="2022-09-20T16:18:06.000Z">
<meta property="article:modified_time" content="2022-09-20T16:27:35.581Z">
<meta property="article:author" content="乐枫">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://lefengpiaoling.github.io/img/top.webp"><link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/lefengpiaoling/piclefeng/img/lefeng.jpg"><link rel="canonical" href="https://lefengpiaoling.github.io/archives/c95afcba"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><meta name="baidu-site-verification" content="code-1YvEIWGUMg"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?4efeb503e3439e4a9188f93a94e5f120";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":false,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'HTML表格及表单的使用',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2022-09-21 00:27:35'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="css/style.css"><meta name="generator" content="Hexo 6.3.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://cdn.jsdelivr.net/gh/lefengpiaoling/piclefeng/img/lefeng.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">4</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fa fa-heartbeat"></i><span> 清单</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/Gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/img/top.webp')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">乐枫的草稿箱</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fa fa-heartbeat"></i><span> 清单</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/Gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">HTML表格及表单的使用</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-09-20T16:18:06.000Z" title="发表于 2022-09-21 00:18:06">2022-09-21</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2022-09-20T16:27:35.581Z" title="更新于 2022-09-21 00:27:35">2022-09-21</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">1.1k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>4分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="HTML表格及表单的使用"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="1-表格标签"><a href="#1-表格标签" class="headerlink" title="1.表格标签"></a>1.表格标签</h2><h3 id="1-表格的作用"><a href="#1-表格的作用" class="headerlink" title="1.表格的作用"></a>1.表格的作用</h3><p>用于显示和展示数据，特点：清爽  </p>
<h3 id="1-2-表格的基本语法"><a href="#1-2-表格的基本语法" class="headerlink" title="1.2.表格的基本语法"></a>1.2.表格的基本语法</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">&lt;table&gt;</span><br><span class="line">    &lt;tr&gt;</span><br><span class="line">        &lt;td&gt;单元格内的文字&lt;/td&gt;</span><br><span class="line">    &lt;/tr&gt;</span><br><span class="line">&lt;/table&gt;</span><br><span class="line">```  </span><br><span class="line">1. ```&lt;table&gt;&lt;/table&gt;``` 定义表格</span><br><span class="line">2. ```&lt;tr&gt;&lt;/tr&gt;```  定义表格的行，必须嵌套早table标签中, table row</span><br><span class="line">3. ```&lt;td&gt;&lt;/td&gt;```  table data 单元格  </span><br><span class="line">   </span><br><span class="line">### 1.3 表头单元格标签</span><br><span class="line"></span><br><span class="line">table head</span><br></pre></td></tr></table></figure>
<table>
    <tr>
        <th>姓名</th>
    </tr>
</table>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">突出重要性  </span><br><span class="line">表头单元格的&lt;b&gt;文字加粗&lt;/b&gt;，居中  </span><br><span class="line">### 1.4 表格属性  </span><br><span class="line">主要通过css设定  </span><br><span class="line">写到table 标签中去</span><br><span class="line"></span><br><span class="line">相关单词：  </span><br><span class="line">1. align:  </span><br><span class="line">   left:靠左对齐  </span><br><span class="line">   center:居中  </span><br><span class="line">   right:靠右 </span><br><span class="line">2. border,边框  </span><br><span class="line">   默认没有边框，border=1  </span><br><span class="line">3. cellpadding  </span><br><span class="line">   规定边沿和内容之间的空白，default=1 </span><br><span class="line">4. cellspacing </span><br><span class="line">   单元格之间的像素填充值，defaul=2， 没有空隙设置为0</span><br><span class="line">   ![20210716202038](https://xd-imgsubmit.oss-cn-beijing.aliyuncs.com/images/20210716202038.png)  </span><br><span class="line">5. width ,设置宽度;height 设置高度  </span><br><span class="line">&lt;font color=red&gt;以上内容均可以通过css设置&lt;/font&gt;  </span><br><span class="line"></span><br><span class="line">### 1.5 表格结构标签  </span><br><span class="line">```&lt;thead&gt;&lt;/thead&gt;```  表格的头部部分  </span><br><span class="line">thead内必须拥有tr标签</span><br><span class="line"></span><br><span class="line">```&lt;tbody&gt;&lt;/tbody&gt;```  表格的主体部分  </span><br><span class="line"></span><br><span class="line">### 1.6 合并单元格 </span><br><span class="line">1. 方式：  </span><br><span class="line">   跨行：rowspan=&quot;合并的单元格的个数&quot;  </span><br><span class="line">   跨列：colspan=&quot;合并的单元格的个数&quot;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">2. 在目标单元格写合并的代码，跨列就写在最左侧的目标单元格，同理</span><br><span class="line"></span><br><span class="line">3. 合并三部曲</span><br><span class="line">   确定合并方式  </span><br><span class="line">   找到目标单元格、写代码  </span><br><span class="line">   删除多余单元格  </span><br><span class="line">   ![20210716205548](https://xd-imgsubmit.oss-cn-beijing.aliyuncs.com/images/20210716205548.png)  </span><br><span class="line">   不删除就会多出来一块  </span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## 2.列表标签  </span><br><span class="line">表格显示数据，列表用于布局  </span><br><span class="line">无序列表 有序列表 自定义列表  </span><br><span class="line">### 2.1 无序列表</span><br><span class="line">```&lt;ul&gt;```表示html页面项目的无序列表，一般以项目符号呈现列表项，列表项使用```&lt;li&gt;```定义  </span><br></pre></td></tr></table></figure>
<ul>
    <li>列表项1</li>
    <li>列表项1</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">列表项之间没有先后顺序之分，无序的   </span><br><span class="line">ul &lt;font color=red&gt;只能放```&lt;li&gt;&lt;/li&gt;```标签&lt;/font&gt;  </span><br><span class="line">li 标签中可以放任意的元素  </span><br><span class="line">### 2.2 有序列表  </span><br><span class="line">使用 ol 表示```&lt;ol&gt;&lt;/ol&gt;```   </span><br><span class="line"></span><br><span class="line">### 2.3 自定义列表 </span><br><span class="line">![20210716211534](https://xd-imgsubmit.oss-cn-beijing.aliyuncs.com/images/20210716211534.png)  </span><br><span class="line">上面一个下标题 下面一堆小标题 ，一个大哥，一群小弟 </span><br><span class="line">用于对属于或者名词进行解释和描述，没有任何项目符号  </span><br><span class="line">语法格式：</span><br></pre></td></tr></table></figure>
<dl>
    <dt>名词1</dt>
    <dd>名词1解释1</dd>
</dl>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line">```&lt;dl&gt;&lt;/dl&gt;``` 表示自定义列表  </span><br><span class="line">![20210716212008](https://xd-imgsubmit.oss-cn-beijing.aliyuncs.com/images/20210716212008.png)  </span><br><span class="line">&lt;b&gt;注意&lt;/b&gt;：</span><br><span class="line">dl 里面只能包含dt和dd  </span><br><span class="line">dt和dd的个数没有限制，他俩是兄弟关系</span><br><span class="line"></span><br><span class="line">### 2.4 总结  </span><br><span class="line">自定义列表：  </span><br><span class="line">![20210716212659](https://xd-imgsubmit.oss-cn-beijing.aliyuncs.com/images/20210716212659.png)  </span><br><span class="line">无序列表： </span><br><span class="line">![20210716212849](https://xd-imgsubmit.oss-cn-beijing.aliyuncs.com/images/20210716212849.png)   </span><br><span class="line"></span><br><span class="line">## 3.表单标签</span><br><span class="line"></span><br><span class="line">收集用户信息，和用户交互 收集信息  </span><br><span class="line">表单域，表单控件， 提示信息  </span><br><span class="line">表单域： 表单的区域  </span><br><span class="line"></span><br><span class="line">### 3.2 组成</span><br><span class="line">表单域：  </span><br><span class="line"> </span><br><span class="line"> ```&lt;form&gt;```  把范围内表单元素信息提交给服务器  </span><br></pre></td></tr></table></figure>
 <form action="url地址" method="提交方式" name="名称"> 
 表单元素控件
 </form>
 <figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"> 了解即可，以后学习，服务器编程以后会学习  </span><br><span class="line"></span><br><span class="line">### 3.4 表单元素：  </span><br><span class="line">1. input 输入表单元素  </span><br><span class="line">2. selct 下拉表单元素</span><br><span class="line">3. textarea 文本域元素    </span><br><span class="line"></span><br><span class="line">#### 3.4.1 input</span><br><span class="line"> </span><br><span class="line">用于收集用户元素  </span><br><span class="line">&lt;font color=red&gt;单标签&lt;/font&gt;  </span><br></pre></td></tr></table></figure>
<input type="属性值" /> 
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line">![20210717161946](https://xd-imgsubmit.oss-cn-beijing.aliyuncs.com/images/20210717161946.png)  </span><br><span class="line"></span><br><span class="line">密码：password  </span><br><span class="line">单选 按钮： radio  </span><br><span class="line">name 属性：   </span><br><span class="line"></span><br><span class="line">多选1，需要设置为相同名字</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">value:  默认显示的内容</span><br><span class="line"></span><br><span class="line">checked 属性:单选按钮和多选按钮，当页面打开的时候，默认打开  </span><br><span class="line">maxlength: 设置最大值，最多输入几个字符  </span><br><span class="line"></span><br><span class="line">type属性：   </span><br><span class="line">submit: 点了之后把表单域的内容 提交给后台， 必须在form标签内  </span><br><span class="line">reset 重置按钮  </span><br><span class="line">button 按钮 用于启动js  </span><br><span class="line">file 上传文件</span><br><span class="line"></span><br><span class="line"> #### 3.4.2 label 标签  </span><br><span class="line"> label 用于绑定一个表单元素 当点击  label的文本时，浏览器将自动聚焦到input 标签内容上去‘</span><br></pre></td></tr></table></figure>
 <label for="sex">男</label>
 <input type="radio" name="sex" id="sex"/>
 ```  
 for 和id设置为相同的属性，完成关联  


<h4 id="3-4-3-select-下拉"><a href="#3-4-3-select-下拉" class="headerlink" title="3.4.3 select 下拉"></a>3.4.3 select 下拉</h4><p> 下拉：select  </p>
<h4 id="3-4-4-文本域-textarea"><a href="#3-4-4-文本域-textarea" class="headerlink" title="3.4.4 文本域 textarea"></a>3.4.4 文本域 textarea</h4><p> 多行文本输入<br> 留言板等<br> <img src="https://xd-imgsubmit.oss-cn-beijing.aliyuncs.com/images/20210717172947.png" alt="20210717172947"></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://lefengpiaoling.github.io">乐枫</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://lefengpiaoling.github.io/archives/c95afcba.html">https://lefengpiaoling.github.io/archives/c95afcba.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noreferrer" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://lefengpiaoling.github.io" target="_blank">乐枫的草稿箱</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="/img/top.webp" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://cdn.jsdelivr.net/gh/lefengpiaoling/piclefeng/img/6aa61ea6d32d2975dae713ad7ed3772.jpg" rel="external nofollow noreferrer" target="_blank"><img class="post-qr-code-img" src="https://cdn.jsdelivr.net/gh/lefengpiaoling/piclefeng/img/6aa61ea6d32d2975dae713ad7ed3772.jpg" alt="wechat"/></a><div class="post-qr-code-desc">wechat</div></li><li class="reward-item"><a href="https://cdn.jsdelivr.net/gh/lefengpiaoling/piclefeng/img/82e33a79989ff81c5850cd2e764ae9a.jpg" rel="external nofollow noreferrer" target="_blank"><img class="post-qr-code-img" src="https://cdn.jsdelivr.net/gh/lefengpiaoling/piclefeng/img/82e33a79989ff81c5850cd2e764ae9a.jpg" alt="alipay"/></a><div class="post-qr-code-desc">alipay</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/archives/11b21107.html"><img class="prev-cover" src="/img/top.webp" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">CSS之选择器的深入理解</div></div></a></div><div class="next-post pull-right"><a href="/archives/833fa472.html"><img class="next-cover" src="/img/top.webp" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">HTML知识点总结“</div></div></a></div></nav><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="lv-container" data-id="city" data-uid="MTAyMC81NzMwNi8zMzc3MA=="></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://cdn.jsdelivr.net/gh/lefengpiaoling/piclefeng/img/lefeng.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">乐枫</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">4</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/lefengpiaoling"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/lefengpiaoling" rel="external nofollow noreferrer" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="https://blog.csdn.net/qq_45985929?type=blog" rel="external nofollow noreferrer" target="_blank" title="CSDN"><i class="fa fa-book-open"></i></a><a class="social-icon" href="tencent://AddContact/?fromId=45&amp;fromSubId=1&amp;subcmd=all&amp;uin=2674604735&amp;website=www.oicqzone.com" rel="external nofollow noreferrer" target="_blank" title="QQ"><i class="fab fa-qq"></i></a><a class="social-icon" href="mailto:2674604735@qq.com" rel="external nofollow noreferrer" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E8%A1%A8%E6%A0%BC%E6%A0%87%E7%AD%BE"><span class="toc-number">1.</span> <span class="toc-text">1.表格标签</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-%E8%A1%A8%E6%A0%BC%E7%9A%84%E4%BD%9C%E7%94%A8"><span class="toc-number">1.1.</span> <span class="toc-text">1.表格的作用</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-2-%E8%A1%A8%E6%A0%BC%E7%9A%84%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95"><span class="toc-number">1.2.</span> <span class="toc-text">1.2.表格的基本语法</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#3-4-3-select-%E4%B8%8B%E6%8B%89"><span class="toc-number">1.2.1.</span> <span class="toc-text">3.4.3 select 下拉</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-4-4-%E6%96%87%E6%9C%AC%E5%9F%9F-textarea"><span class="toc-number">1.2.2.</span> <span class="toc-text">3.4.4 文本域 textarea</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/archives/11b21107.html" title="CSS之选择器的深入理解"><img src="/img/top.webp" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="CSS之选择器的深入理解"/></a><div class="content"><a class="title" href="/archives/11b21107.html" title="CSS之选择器的深入理解">CSS之选择器的深入理解</a><time datetime="2022-09-20T16:21:35.000Z" title="发表于 2022-09-21 00:21:35">2022-09-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/archives/c95afcba.html" title="HTML表格及表单的使用"><img src="/img/top.webp" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="HTML表格及表单的使用"/></a><div class="content"><a class="title" href="/archives/c95afcba.html" title="HTML表格及表单的使用">HTML表格及表单的使用</a><time datetime="2022-09-20T16:18:06.000Z" title="发表于 2022-09-21 00:18:06">2022-09-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/archives/833fa472.html" title="HTML知识点总结“"><img src="/img/top.webp" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="HTML知识点总结“"/></a><div class="content"><a class="title" href="/archives/833fa472.html" title="HTML知识点总结“">HTML知识点总结“</a><time datetime="2022-09-20T16:10:40.000Z" title="发表于 2022-09-21 00:10:40">2022-09-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/archives/4a17b156.html" title="Hello World"><img src="/img/top.webp" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Hello World"/></a><div class="content"><a class="title" href="/archives/4a17b156.html" title="Hello World">Hello World</a><time datetime="2022-09-18T14:39:40.086Z" title="发表于 2022-09-18 22:39:40">2022-09-18</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2016 - 2022 By 乐枫</div><div class="footer_custom_text">我相信我可以，但我一直在路上，所以我有无限的可能！！</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (false){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><script src="/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>function loadLivere () {
  if (typeof LivereTower === 'object') {
    window.LivereTower.init()
  }
  else {
    (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
    })(document, 'script');
  }
}

if ('Livere' === 'Livere' || !true) {
  if (true) btf.loadComment(document.getElementById('lv-container'), loadLivere)
  else loadLivere()
}
else {
  function loadOtherComment () {
    loadLivere()
  }
}</script></div><div class="aplayer no-destroy" data-id="60198" data-server="netease" data-type="playlist" data-fixed="true" data-autoplay="true"> </div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/metingjs/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = ["meta[property=\"og:image\"]","meta[property=\"og:title\"]","meta[property=\"og:url\"]","head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
  window.scrollCollect && window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

  typeof disqusjs === 'object' && disqusjs.destroy()
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/koharu.model.json"},"display":{"position":"right","width":145,"height":315},"mobile":{"show":true,"scale":0.5},"react":{"opacityDefault":0.7,"opacityOnHover":0.8},"log":false});</script></body></html>